package com.redpigedu.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.redpigedu.dao.UserDao;
import com.redpigedu.entity.User;
import com.redpigedu.service.UserService;

/**
 * 管理员Service实现类
 * @author redpigedu_code
 *
 */
@Service("userService")
@Transactional(readOnly=true) //这里设置所有方法事务为只读,如果是增删改需要在方法上另外设置,看下面例子。
public class UserServiceImpl implements UserService{

	@Resource
	private UserDao userDao;

	@Override
	public User getByUserName(String userName) {
		return userDao.getByUserName(userName);
	}


	@Override
	public List<User> listAll() {
		return this.userDao.listAll();
	}
	
	@Transactional(readOnly=false)
	@Override
	public int updateByUserName(User user) {
		return this.userDao.updateByUserName(user);
	}
	
	

}
